import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
import Layout from '@/views/Layout.vue'
import List from '@/views/users/List.vue'
import Add from '@/views/users/Add.vue'
import LoginView from "@/views/LoginView.vue";

const routes = [
    {path:'/login',name:'Login',component: LoginView},
    {
        path: '/',
        component: Layout,
        children: [

            {
                path: '/user/list',
                name: 'UserList',
                component: List,
                meta: { title: '用户列表' }
            },
            {
                path: '/user/add',
                name: 'UserAdd',
                component: Add,
                meta: { title: '添加用户' }
            },
            {
                path: '/system/role',
                name: 'RoleList',
                component: List,
                meta: { title: '角色管理' }
            },
            {
                path: '/system/menu',
                name: 'MenuList',
                component: List,
                meta: { title: '菜单管理' }
            },
            {
                path: '/monitor',
                name: 'Monitor',
                component: List,
                meta: { title: '系统监控' }
            },
            // 默认重定向
            {
                path: '/',
                redirect: '/login'
            }
        ]
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router